import request from '@/config/axios'

const baseURL = '/train/news'

export const getNewsPage = async (params: PageParam) => {
  return await request.get({
    url: `${baseURL}/page`,
    data: params
  })
}

// 创建
export const newsCreate = async (data) => {
  return await request.post<boolean>({
    url: `${baseURL}/create`,
    data
  })
}

export const getNewsById = async (id: string) => {
  return await request.get({
    url: `${baseURL}/get?id=` + id
  })
}

export const updateNewse = async (data) => {
  return await request.post<boolean>({
    url: `${baseURL}/update`,
    data
  })
}

export const deleteNews = async (id: string) => {
  return await request.delete<boolean>({
    url: `${baseURL}/delete?id=` + id
  })
}
